]> dgit.raspbian.org Git - pcre2.git/commitdiff
Backport of pcre2-10.48-Fix-JIT-STR_END.patch
authorZoltan Herczeg <zherczeg7@gmail.com>
Thu, 21 May 2026 03:56:00 +0000 (05:56 +0200)
committerMatthew Vernon <matthew@debian.org>
Tue, 1 Sep 2026 10:43:48 +0000 (11:43 +0100)
Cherry-pick of ff92e0b9cea5b5ae3af12ba930d03556684f098b

Fix setting STR_END in JIT (#912)

When OP_VREVERSE is present in a non-atomic LOOKBEHIND ASSERTION,
the STR_END must be set before the backtracking path is executed.

(cherry picked from commit 0aa5bbca3ac70e6c22562488ead6cb2032447fc5)

src/pcre2_jit_compile.c
src/pcre2_jit_test.c

index 90592c184ffb9cffd59a411aaaa0945b670b7225..48a0b3e1c765fdc833101884039f474bae91ad80 100644 (file)
@@ -12231,6 +12231,8 @@ else if (SLJIT_UNLIKELY(opcode == OP_ASSERT_SCS))
   if (common->restore_end_ptr == 0)
     common->restore_end_ptr = private_data_ptr + sizeof(sljit_sw);
   }
+else if (SLJIT_UNLIKELY(opcode == OP_ASSERTBACK_NA) && PRIVATE_DATA(ccbegin + 1))
+  OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
 
 if (SLJIT_UNLIKELY(opcode == OP_ONCE))
   {
index b336abea290a42cf48b64cc39d8b343510018f85..8344c444976f3fdf248f2a3e5d34354319f9a220 100644 (file)
@@ -652,6 +652,7 @@ static struct regression_test_case regression_test_cases[] = {
        { MU, A, 0, 0, "a(?=)b", "ab" },
        { MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" },
        { MU, A, 0, 0, "(?(?<!|(|a)))", "a" },
+       { MU, A, 0, 3, "(?<*(.).{,2})\\1", "BABA" },
 
        /* Not empty, ACCEPT, FAIL */
        { MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "a*", "bcx" },